package com.ssm.server.sendgoods.controller;

import com.ssm.server.common.JsonData;
import com.ssm.server.sendgoods.service.SendGoodsService;
import com.ssm.server.user.service.UserService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author zhangyibo
 */
@RestController
public class SendGoodsController {
    @Autowired
    private SendGoodsService sendGoodsService;
    
    /*
     *获取收货地址
     */
    @RequestMapping("/sendGoods/getAddressByUser")
    public JsonData getAddressByUser(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.getAddressByUser(param);
    }
    /*
     *新增收货地址
     */
    @RequestMapping("/sendGoods/saveAddress")
    public JsonData saveAddress(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.saveAddress(param);
    }
    
    /*
     *提交发货信息
     */
    @RequestMapping("/sendGoods/saveSendGoods")
    public JsonData saveSendGoods(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.saveSendGoods(param);
    }
    
    /*
     *发货管理
     */
    @RequestMapping("/sendGoods/getSendGoods")
    public JsonData getSendGoods(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.getSendGoods(param);
    }
    
    /*
     *确认收货
     */
    @RequestMapping("/sendGoods/updateSendGoodsState")
    public JsonData updateSendGoodsState(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.updateSendGoodsState(param);
    }
    /*
     *修改收货地址信息
     */
    @RequestMapping("/sendGoods/updateAddress")
    public JsonData updateAddress(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.updateAddress(param);
    }
    
    /*
     *删除收货地址
     */
    @RequestMapping("/sendGoods/deleteAddress")
    public JsonData deleteAddress(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.deleteAddress(param);
    }
    /*
     *设为默认收货地址
     */
    @RequestMapping("/sendGoods/updateAddressState")
    public JsonData updateAddressState(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.updateAddressState(param);
    }
    
    /*
     *收货方式包邮
     */
    @RequestMapping("/sysParam/findSysParamByKey")
    public JsonData findSysParamByKey(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.findSysParamByKey(param);
    }
    
    
    /*
     *收货方式到付
     */
    @RequestMapping("/sysParam/findSysParamByToPay")
    public JsonData findSysParamByKeys(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.findSysParamByKeys(param);
    }
    /*
     *收货方式到付
     */
    @RequestMapping("/sendGoods/getSendState")
    public JsonData getSendState(@RequestParam Map<String, String> param) throws Exception {
        return sendGoodsService.getSendState(param);
    }
    
    
}
